package com.wlz.controller;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.wlz.entity.Test;
import com.wlz.listener.TEmployeeExcelListener;
import com.wlz.listener.TestExcelListener;
import com.wlz.model.TEmployee;
import com.wlz.service.ITEmployeeService;
import com.wlz.service.TestService;
import com.wlz.utils.EasyExcelHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.UUID;

/**
 * @author： wlz
 * @Date 2021/3/1 10:48
 * @description： TODO
 * @version: 1.0
 */

@Slf4j
@RequiredArgsConstructor
@Controller
@RequestMapping(path = "/test")
public class TestController {

    private final TestService testService;


    /**
     *  导入
     * @param file
     * @return
     * @throws IOException
     */
    @RequestMapping("/import")
    @ResponseBody
    public String importexcel() throws IOException {
        EasyExcel.read("/Users/wlz/Desktop/8月1-8月18.xlsx", Test.class, new TestExcelListener(testService)).sheet().doRead();
        return "success";
    }

}
